﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PhysicsProject.Models;

namespace PhysicsProject.ViewModels
{
    public class ThermometerViewModel : ViewModelBase
    {
        private readonly Thermometer _thermometerModel;

        private bool _isEnabled;

        public ThermometerViewModel(Thermometer thermometerModel)
        {
            _thermometerModel = thermometerModel;
        }

        public ThermometerViewModel(Thermometer thermometerModel, bool isEnabled)
        {
            _thermometerModel = thermometerModel;
            IsEnabled = isEnabled;
        }

        public bool IsEnabled
        {
            get { return _isEnabled; }
            set
            {
                _isEnabled = value;
                OnPropertyChanged();
            }
        }

        public Box RightBox
        {
            get { return _thermometerModel.RightBox; }
            set
            {
                _thermometerModel.RightBox = value;
                OnPropertyChanged();
            }
        }

        public Box LeftBox
        {
            get { return _thermometerModel.LeftBox; }
            set
            {
                _thermometerModel.LeftBox = value;
                OnPropertyChanged();
            }
        }

        public float CurrentTemperature
        {
            get { return _thermometerModel.CurrentTemperature; }
            set
            {
                _thermometerModel.CurrentTemperature = value;
                OnPropertyChanged();
            }
        }

        public Material RightBoxMaterialType
        {
            get { return _thermometerModel.RightBox.MaterialType; }
            set
            {
                _thermometerModel.RightBox.MaterialType = value;
                OnPropertyChanged();
                OnPropertyChanged("RightBoxCoefficient");
            }
        }

        public float RightBoxCoefficient
        {
            get { return _thermometerModel.RightBox.MaterialType.Coefficient; }
        }
    }
}
